<template>
	<view>
		<!-- 查企业 未开通-->
		<view class="zhaorenmai" v-if="tabName=='找人脉'">
			<view class="tab-box">
				<view :class="zrmtabIndex=='0' ?'active' :''" @click="zrmtabClick('0')">
					企业联系方式
				</view>
				<view :class="zrmtabIndex=='1' ?'active' :''" @click="zrmtabClick('1')">
					工商联系方式
				</view>
			</view>
			<!-- 解锁信息 -->
			<view>
				<view class="lxrList">
					<view class="lxr-top">
						<view class="lxr-left">
							<image src="https://img.bidcenter.com.cn/uni/qiqing/lxr.png" mode=""></image>
						</view>
						<view class="lxr-right">
							<view class="d-b-c">
								<view class="lxr-name">采招经理</view>
								<view class="lxr-xgxm">20个相关项目</view>
							</view>
							<view class="d-b-c">
								<view class="lxr-tel">
									400-810-9688
								</view>
								<view class="lxr-gxsj">更新时间：2024/08/29</view>
							</view>
						</view>
					</view>
					<view  class="lxr-middle text-ellipsis">
						最新项目：浙江卓宏建设项目管理有限公司关于绍兴市柯项目...
					</view>
					<view class="caozuo">
						<view @click="addPhone('采招经理','400-810-9688')">
							<image src="https://img.bidcenter.com.cn/uni/qiqing/tongxunlu.png" mode=""></image>
							<text>添加到通讯录</text>
						</view>
						<view @click="copyTel('400-810-9688')">
							<image src="https://img.bidcenter.com.cn/uni/qiqing/fuzhi.png" mode=""></image>
							<text>复制</text>
						</view>
						<view @click="rengongkaitong">
							<image src="https://img.bidcenter.com.cn/uni/qiqing/dianhua.png" mode=""></image>
							<text>打电话</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 未开通 --项目信息-->
		<view  class="weikaitong">
			<image src="https://img.bidcenter.com.cn/uni/qiqing/weikaitong.png" v-if="tabName !=='找人脉'"></image>

			<view class="title" v-if="tabName=='项目信息'">
				精准定位该公司历史项目信息
			</view>
			<view class="title" v-if="tabName=='招标分析'||tabName=='中标分析' ||tabName=='代理分析'">
				信息洞察企业，数据驱动决策
			</view>
			<view class="title" v-if="tabName=='找人脉'">
				联系搭建桥梁，沟通决定成败
			</view>
			<view class="title" v-if="tabName=='查企业'">
				打破企业信息差
			</view>
			
			
			<view class="desc"v-if="tabName=='项目信息'">
				该功能需要开通会员
			</view>
			<view class="desc" v-if="tabName=='招标分析'||tabName=='中标分析' ||tabName=='代理分析'">
				开通会员后可查看
			</view>
			<view class="desc" v-if="tabName=='找人脉'">
				购买会员与查人脉后可使用
			</view>
			<view class="desc" v-if="tabName=='查企业'">
				开通会员和企业拓客后可查看
			</view>
			
			<view class="btn">
				<button @click="lijikaitong">
					立即开通
				</button>
				<!-- <button @click="rengongkaitong">
					人工开通
				</button> -->
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		name: "Weikaitong",
		props: ['tabName','location',],
		data() {
			return {
				zrmtabIndex:0,
			};
		},
		
		watch:{
			
		},
		
		created(){
			// console.log(this.tabName)
		},

		methods: {
			//立即开通跳转到会员支付页面-自动勾选
			lijikaitong(){
				uni.navigateTo({
					url:'/pages/user/huiyuan/payment?tuoke=1',
				})
			},
			//人工开通-拉起小程序页面
			rengongkaitong(){
				uni.$u.http.post('public/SendNoticeToBidUserHandler.ashx', {
					location: this.location,
					type: 5095, // APP用到 5095：人工开通会员通知；
				})
				plus.share.getServices(res => {
					let sweixin = null;
					sweixin = res.find(i => i.id === 'weixin')
					uni.showToast({
						title: sweixin,
						icon: 'none'
					})
				
					if (sweixin) {
						// 分享跳转到微信小程序
						sweixin.launchMiniProgram({
							id: "gh_cd40829a4ca1", //微信小程序原生id
							path: "pagesOne/kefujingli/addkefu", //    打开小程序的页面路径，不传默认跳转首页
							type: 0 //     微信小程序版本类型，可取值： 0-正式版； 1-测试版； 2-体验版。 默认值为0。
						})
					} else {
						uni.showToast({
							title: '请安装微信',
							icon: 'none'
						})
					}
				}, err => {
					console.log("分享失败"); // 获取分享服务列表失败
				});
				
			},
			//顶部tab切换
			zrmtabClick(index){
				this.zrmtabIndex=index
			},
			// 拨打电话
			makePhoneCall(tel) {
				uni.makePhoneCall({
					phoneNumber: tel,
				});
			},
			
			// 复制电话号码
			copyTel(tel) {
				uni.setClipboardData({
					data: tel,
					success: () => {
						this.currentIndex = -1;
						this.maskPop = false
					},fail:(err)=>{
						console.log(err)
					}
			
				})
			},
			
			// 添加到通讯录
			addPhone(name, tel) {
				uni.addPhoneContact({
					firstName: name,
					mobilePhoneNumber: tel,
					success: function (e) {
						uni.$u.toast('添加成功');
					},
					fail: function (e) {
						uni.$u.toast('添加失败');
					}
					
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "@/static/css/index.scss";
	.weikaitong{
		padding-top: 76rpx;
		margin-bottom: 200rpx;
		text-align: center;
		image{
			width: 400rpx;
			height: 310rpx;
		}
		.title{
			font-size: 28rpx;
			color: #3B3E45;
			font-weight: bold;
		}
		.desc{
			margin-top: 20rpx;
			font-size: 24rpx;
			color: #6C717E;
		}
		.btn{
			width: 600rpx;
			margin: 0 auto;
			margin-top: 46rpx;
			display: flex;
			button{
				display: inline-block;
				flex:1;
				height: 88rpx;
				line-height: 88rpx;
				font-size: 32rpx;
				font-weight: bold;
				border-radius: 4rpx;
				border: 0;
				&::after{
					border: none;
				}
				&:first-child{
					margin-right: 40rpx;
					color: #fff;
					background: linear-gradient( 90deg, #1F91FF 0%, #1D11FB 100%);
				}
				// &:last-child{
				// 	color: #82410E;
				// 	background: linear-gradient( 90deg, #FCE37E 0%, #FBA767 100%);
				// }
			}
		}
	}
	.zhaorenmai{
		padding: 0 28rpx;
	}
	.tab-box{
		display: flex;
		padding: 16rpx 0 0 24rpx;
		view{
			margin-right: 40rpx;
			font-size: 28rpx;
			color: #6C717E;
			&.active{
				font-weight: bold;
				color: #2F6DFE;
			}
		}
	}
	.lxrList{
		padding: 0 30rpx;
		margin-top: 16rpx;
		border-top: 1rpx solid #E8E8E8;
		.lxr-top{
			padding: 20rpx 0 0;
			display: flex;
			justify-content: space-between;
		}
		.lxr-left{
			image{
				width: 88rpx;
				height: 88rpx;
				margin-right: 26rpx;
			}
		}
		.lxr-right{
			flex: 1;
			.lxr-name{
				font-size: 28rpx;
				color: #333333;
				font-weight: bold;
			}
			.lxr-xgxm{
				padding: 0 16rpx;
				height: 36rpx;
				line-height: 36rpx;
				font-size: 22rpx;
				color: #A4A8B0;
				border-radius: 4rpx;
				border: 1px solid #E8E8E8;
			}
			.lxr-tel,.lxr-gxsj{
				margin-top: 12rpx;
				font-size: 24rpx;
				color: #A4A8B0;
			}
		}
		.lxr-middle{
			margin-top: 26rpx;
			font-size: 22rpx;
			color: #6C717E;
		}
		.caozuo{
			margin-top: 24rpx;
			display: flex;
			justify-content: space-between;
			view{
				display: flex;
				align-items: center;
				image{
					width: 52rpx;
					height: 52rpx;
					margin-right: 10rpx;
				}
				text{
					font-size: 22rpx;
					color: #333333;
				}
			}
		}
	}
	
</style>